package situ.autoweter.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import situ.autoweter.service.UsFormulaService;
import situ.autoweter.entity.UsFormula;
import java.util.*;
/**
 * UsFormula的路由接口服务
 * 
 * @author 胡文
 *
 */
@Controller
public class UsFormulaController {

	/** UsFormulaService服务 */
	@Autowired
	private UsFormulaService usFormulaService;
	
	/**
	 * 查询所有UsFormula数据的方法
	 * @param value
	 * @return
	 */
	@RequestMapping(value = "queryUsFormula", produces = {"application/json;charset=UTF-8"})
	public String find(UsFormula value,Map map) {
		 List<UsFormula> list= usFormulaService.find(value);
         map.put("items",list);
         return "页面名称自己改";
	}
	
	/**
	 * 通过id查询UsFormula数据的方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "queryUsFormulaById/{id}", produces = {"application/json;charset=UTF-8"})
	public String findOne(@PathVariable(name="id") Object id,Map map) {
        UsFormula obj=  usFormulaService.findOne(id);
        map.put("UsFormula",obj);
        return "页面名称自己改";
	}
	
	/**
	 * 插入UsFormula属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "saveUsFormula", produces = {"application/json;charset=UTF-8"})
	public String save(UsFormula value) {
		  usFormulaService.saveNotNull(value);
        return "redirect:/queryUsFormula";
	}
	
	/**
	 * 更新UsFormula属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "updateUsFormula", produces = {"application/json;charset=UTF-8"})
	public String update(UsFormula value) {
		  usFormulaService.updateNotNullById(value);
          return "redirect:/queryUsFormula";
	}
	
	/**
	 * 通过id删除UsFormula数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "delUsFormulaById/{id}", produces = {"application/json;charset=UTF-8"})
	public String delete(@PathVariable(name="id") Object id) {
		  usFormulaService.deleteById(id);
          return "redirect:/queryUsFormula";
	}
}
